#ifndef __CONN_H__
#define __CONN_H__

typedef struct Conn {
    void    *data;  /* For upstream connection, it points to the upstream */
    ds_pool_s   *pool;
    Event   *read;
    Event   *write;

    int fd;
    off_t   sent;
    off_t index;

    Buf *buffer;                /* temp buf for the coming http header */

    struct Request *request;
    struct Response *response;
    struct Task *task;          /* For main connection */

    unsigned    eof:1;          /* client close the connection */
    unsigned    err:1;          /* error when read or write */
} Conn;

Conn * CONN_Get_Connection(int sock);
void CONN_Free_Connection(Conn *c);
void CONN_Close_Connection(Conn *c);

#endif

